//
//  MyCollectionCell.m
//  Car
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "MyCollectionCell.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
@interface MyCollectionCell ()

@property (nonatomic, strong) UIImageView *image;
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) UIImageView *imageView;

@end

@implementation MyCollectionCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {

        
        self.image = [[UIImageView alloc] init];
        [self.contentView addSubview:self.image];
        
        self.label = [[UILabel alloc] init];
        [self.contentView addSubview:self.label];
        

    }
    return self;
}


- (void)setDiscuss:(YZLDiscuss *)discuss {
    if (_discuss != discuss) {
        _discuss = discuss;
    }
    self.label.text = _discuss.title;
    self.image.image = [UIImage imageNamed:_discuss.image];
    self.label.textAlignment = 1;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super applyLayoutAttributes:layoutAttributes];
    self.label.frame = CGRectMake(0, HEIGHT/9, WIDTH/3, HEIGHT/6-HEIGHT/9);
    self.image.frame = CGRectMake(WIDTH/11, HEIGHT/40, WIDTH/7, WIDTH/7);
}

@end
